//?????? ??? tdc 
function TdcFilter(){
	this.tdc=null;
	this.control=null;	//???????, ?????? ?? ???????? ???????? ??? ????????? ??????
	this.state=null; //??????? checkbox,???????????? ????????? ???????
	this.inputRow = null;//?????? ? ?????????? input ??????????? ??? ?????????? ???????
	this.nextSibling = null; //??????, ?????? ???????? ????? ????????????? ?? ?????? ?????? this.inputRow ??? ?????????? ???????
	//this.irHeight=0;
	this.inputs=new Array();
	this.where=""; //????????? where ??? tdc 
	this.whereAdd=""; //????????? where ??? tdc 
	this.timeout=1500;
	this.toggle=function(obj){
		if (obj!=this.state){
			this.state.checked=!this.state.checked;	
		}
		var isOn = this.state.checked;
		//var nsh = this.nextSibling.style.height;
		if (isOn==false) {
			//this.irHeight = this.inputRow.offsetHeight;
			this.inputRow.style.display="none";
			this.clear();
			//this.nextSibling.style.height = (parseInt(nsh)+this.irHeight)+"px";
		} else {
			//this.nextSibling.style.height = (parseInt(nsh)-this.irHeight)+"px";
			this.inputRow.style.display="";	
		}
	}
	this.clear=function(){
		var length=this.inputs.length;
		for (var index=0;index<length;index++){
			var input=this.inputs[index];
			input.value="";
		}
		this.where="";
		this.tdc.Filter="";
		this.tdc.Reset();
	}
	this.toid=null;
	
	this.filterChange=function(){
		var length=this.inputs.length;
		var where="";
		for (var index=0;index<length;index++){
			var input=this.inputs[index];
			var field=input.getAttribute("cname");
			var value=new String(input.value);
			if (value=="") continue;
			//??? ??????????? ???????? ?????? ???????? ?????????????? ?????? 
			if (where!="") where+="&";
			where+=field+"="+value;
			var type=input.getAttribute("ctype");
			if (type=="Date") continue;
			where+="*"; //??? ????????? ????????? *
		}
		if (this.whereAdd) where+="&"+this.whereAdd;
		if (where==this.where) return;
		if (this.toid) clearTimeout(this.toid);
		this.where=where;
		this.tdc.Filter=this.where;
		this.tdc.AppendData="False";
		var tdc=this.tdc;
		this.toid=setTimeout(function(){tdc.Reset();},this.timeout);
	}
	
	
}
